﻿using StackExchange.Redis;
using StackExchange.Redis.Maintenance;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace DeZhen.Core.Redis.Service
{
    public interface IRedisPlatform
    {
        public IConnectionMultiplexer ConnectionMultiplexer { get; }
        public IDatabase RedisClient { get; }
        public T Get<T>(RedisKey key) where T : class;
        public Task<T> GetAsync<T>(RedisKey key) where T : class;
        public RedisValue StringGet(RedisKey key);
        public Task<RedisValue> StringGetAsync(RedisKey key);
        public bool Set(RedisKey key, Object value, TimeSpan? expiry = null, bool keepTtl = false, When when = When.Always, CommandFlags flags = CommandFlags.None);
        public Task<bool> SetAsync(RedisKey key, Object value, TimeSpan? expiry = null, bool keepTtl = false, When when = When.Always, CommandFlags flags = CommandFlags.None);
        public bool StringSet(RedisKey key, RedisValue value, TimeSpan? expiry = null, bool keepTtl = false, When when = When.Always, CommandFlags flags = CommandFlags.None);
        public Task<bool> StringSetAsync(RedisKey key, RedisValue value, TimeSpan? expiry = null, bool keepTtl = false, When when = When.Always, CommandFlags flags = CommandFlags.None);
        public bool KeyDelete(RedisKey key, CommandFlags flags = CommandFlags.None);
        public long KeyDelete(RedisKey[] keys, CommandFlags flags = CommandFlags.None);
        public Task<bool> KeyDeleteAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
        public Task<long> KeyDeleteAsync(RedisKey[] keys, CommandFlags flags = CommandFlags.None);
        public bool KeyExists(RedisKey key, CommandFlags flags = CommandFlags.None);
        public Task<bool> KeyExistsAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
    }
}
